package com.zretc.baiDuFace;
import java.util.HashMap;
import java.util.Map;
import com.zretc.util.GsonUtils;
import com.zretc.util.HttpUtil;
public class GetFaceList {
	
	
	
	public static String Getfacelist(String groupId,String userId) {
		 // 请求url
	    String url = "https://aip.baidubce.com/rest/2.0/face/v3/faceset/face/getlist";

	    try {
	    	 Map<String, Object> map = new HashMap<>();
	            map.put("user_id", userId);
	            map.put("group_id", groupId);
	        String param = GsonUtils.toJson(map);
	
	        // 注意这里仅为了简化编码每一次请求都去获取access_token，线上环境access_token有过期时间， 客户端可自行缓存，过期后重新获取。
	        String accessToken = "24.810201ae6dcaa18b5376db6258eb9e42.2592000.1597653190.282335-21458214";
	
	        String result = HttpUtil.post(url, accessToken, "application/json", param);
	        System.out.println(result);
	        return result;
	    } catch (Exception e) {
	        e.printStackTrace();
	    }
	    return null;
	}

public static void main(String[] args) {
	
	GetFaceList.Getfacelist("faceLogin", "0001");
}
}
